package com.googlecode.cpbi.util;

import java.net.URLClassLoader;

import org.osgi.framework.BundleContext;


/**
 * @author Jeremy Wales
 */
public class ClassLoaderUtils {

	private ClassLoaderUtils() {
	}

	/**
	 * Defines the "system" ClassLoader as the one that loaded <code>BundleContext</code>, not as the one returned by
	 * <code>ClassLoader.getSystemClassLoader()</code>. Why? Because the Maven test phase uses ClassWorlds, not the
	 * normal Class Path.
	 */
	public static URLClassLoader getSystemClassLoader() {
		// TODO handle non-URLClassLoader system ClassLoader
		return (URLClassLoader) BundleContext.class.getClassLoader();
	}
}
